<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <my-com3></my-com3>
    </div>

    <div id="app2">
        <my-com3></my-com3>
        <login></login>
    </div>


    <!-- 在被控制的#app 外面，使用template元素，定义组件的html模板结构 -->
    <template id="tmpl">
        <div>
            <h1>这是通过template元素，在外部定义的组件结构，这个方式，有代码的智能提示和高亮</h1>
            <h4>好用</h4>
        </div>
    </template>

    <template id="tmpl2">
        <div>
            <h1>这是私有的login组件</h1>
        </div>
    </template>

    <script>
        Vue.component('myCom3', {
            template: '#tmpl'
        })

        var vm = new Vue({
            el: '#app',
            data: {},
            methods: {}
        })


        var vm2 = new Vue({
            el: '#app2',
            data: {},
            methods: {},
            filters: {},
            directives: {},
            components: {
                login: {
                    template: '#tmpl2'
                }
            },

            beforeCreate() {},
            created() {},
            beforeMount() {},
            mounted() {},
            beforeUpdate() {},
            updated() {},
            beforeDestroy() {},
            destroyed() {}
        })
    </script>
</body>

</html>